using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class creature_ai_texts : MangosBase
	{
		public System.Int32? entry;
		public System.String content_default;
		public System.String content_loc1;
		public System.String content_loc2;
		public System.String content_loc3;
		public System.String content_loc4;
		public System.String content_loc5;
		public System.String content_loc6;
		public System.String content_loc7;
		public System.String content_loc8;
		public System.UInt32? sound;
		public System.Byte? type;
		public System.Byte? language;
		public System.UInt16? emote;
		public System.String comment;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `creature_ai_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}');", entry.GetValueOrDefault(), content_default.MySQLDBString(), content_loc1.MySQLDBString(), content_loc2.MySQLDBString(), content_loc3.MySQLDBString(), content_loc4.MySQLDBString(), content_loc5.MySQLDBString(), content_loc6.MySQLDBString(), content_loc7.MySQLDBString(), content_loc8.MySQLDBString(), sound.GetValueOrDefault(), type.GetValueOrDefault(), language.GetValueOrDefault(), emote.GetValueOrDefault(), comment.MySQLDBString());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `creature_ai_texts` SET ");
			if(content_default != null)
			{
				sb.AppendLine("`content_default`='" + content_default.MySQLDBString() + "'");
			}
			if(content_loc1 != null)
			{
				sb.AppendLine("`content_loc1`='" + content_loc1.MySQLDBString() + "'");
			}
			if(content_loc2 != null)
			{
				sb.AppendLine("`content_loc2`='" + content_loc2.MySQLDBString() + "'");
			}
			if(content_loc3 != null)
			{
				sb.AppendLine("`content_loc3`='" + content_loc3.MySQLDBString() + "'");
			}
			if(content_loc4 != null)
			{
				sb.AppendLine("`content_loc4`='" + content_loc4.MySQLDBString() + "'");
			}
			if(content_loc5 != null)
			{
				sb.AppendLine("`content_loc5`='" + content_loc5.MySQLDBString() + "'");
			}
			if(content_loc6 != null)
			{
				sb.AppendLine("`content_loc6`='" + content_loc6.MySQLDBString() + "'");
			}
			if(content_loc7 != null)
			{
				sb.AppendLine("`content_loc7`='" + content_loc7.MySQLDBString() + "'");
			}
			if(content_loc8 != null)
			{
				sb.AppendLine("`content_loc8`='" + content_loc8.MySQLDBString() + "'");
			}
			if(sound != null)
			{
				sb.AppendLine("`sound`='" + sound.Value.ToString() + "'");
			}
			if(type != null)
			{
				sb.AppendLine("`type`='" + type.Value.ToString() + "'");
			}
			if(language != null)
			{
				sb.AppendLine("`language`='" + language.Value.ToString() + "'");
			}
			if(emote != null)
			{
				sb.AppendLine("`emote`='" + emote.Value.ToString() + "'");
			}
			if(comment != null)
			{
				sb.AppendLine("`comment`='" + comment.MySQLDBString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `entry`='" + entry.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
